<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script src="../../res/js/jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../res/layui/layui.js" charset="utf-8"></script>
    <script src="../../res/js/Tools.js" type="text/javascript"></script>
</head>
<style type="text/css">
    table {
        margin-top: 10px;
        font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
        color: #666666;
        width: 100%;
    }

    td {
        padding: 0 15px;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        box-sizing: border-box;
    }

    tr {
        height: 35px;
    }

    .head {

        background: #F2F2F2;
        width: 25%;
    }

    .itemhead, .itembody {
        font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
        color: #000;
    }

    .fujian, .fujian td {
        border-color: #fff;
    }

    .body {
        width: 25%;
    }
</style>
<body>

<table border="1" id="tab" bordercolor="#E6E6E6" cellspacing="0">

</table>
<script type="text/javascript">

    /**
     * 数据库日期转化为 2019-10-29 12:00:00格式
     * @param value
     * @returns {string}
     */
    function dateTime(value) {
        var da = new Date(value.replace("/Date(", "").replace(")/", "").split("+")[0]);
        return da.getFullYear() + "-" + ((da.getMonth() + 1) < 10 ? "0" + (da.getMonth() + 1) : (da.getMonth() + 1)) + "-" + (da.getDate() < 10 ? "0" + da.getDate() : da.getDate()) + " " + (da.getHours() < 10 ? "0" + da.getHours() : da.getHours()) + ":" + (da.getMinutes() < 10 ? "0" + da.getMinutes() : da.getMinutes()) + ":" + (da.getSeconds() < 10 ? "0" + da.getSeconds() : da.getSeconds());
    }

    /**
     * 数据库日期转化为 2019-10-29格式
     * @param value
     * @returns {string}
     */
    function date(value) {
        var da = new Date(value.replace("/Date(", "").replace(")/", "").split("+")[0]);
        return da.getFullYear() + "-" + ((da.getMonth() + 1) < 10 ? "0" + (da.getMonth() + 1) : (da.getMonth() + 1)) + "-" + (da.getDate() < 10 ? "0" + da.getDate() : da.getDate());
    }

    $(function () {
        var id = getQueryString("weekId");
        var url = "../../../atsPlanWeekController/weekById";
        var data = {weekId: id, pid: id}
        var body = null;
        $.post(url, data, function (obj) {

                body = '<tr>' +
                    '<td class="head">计划名称</td>' +
                    '<td class="body">' + obj.data.weekName + '</td>' +
                    '<td class="head">运动项目名称</td>' +
                    '<td class="body">' + obj.data.itemName + '</td>' +
                    '</tr><tr>' +
                    '<td class="head">教练员姓名</td>' +
                    '<td class="body">' + obj.data.coachName + '</td>' +
                    '<td class="head">其他教练员</td>' +
                    '<td class="body">' + obj.data.otherCoach + '</td>' +
                    '</tr><tr>' +
                    '<td class="head">制定时间</td>' +
                    '<td class="body">' + obj.data.planDate + '</td>' +
                    '<td class="head">阶段计划名称</td>' +
                    '<td class="body">' + obj.data.phaseName + '</td>' +
                    '</tr><tr>' +
                    '<td class="head">周训练任务</td>' +
                    '<td class="body">' + obj.data.weekMission + '</td>' +
                    '<td class="head">周训练重点</td>' +
                    '<td class="body">' + obj.data.weekEmphasis + '</td>' +
                    '</tr>';
                body += '<tr  style="height: 10px" class="fujian"><td colspan="4"></td><tr class="fujian">';
                if (obj.data.file1 != "" && obj.data.file1 != null) {
                    body += '<td align="right" class="body"><a target="_blank" href="../../../' + obj.data.file1 + '" class="layui-btn layui-btn-primary">附件1</a></td>';
                }
                if (obj.data.file2 != "" && obj.data.file2 != null) {
                    body += '<td colspan="2" align="center" class="body"><a href="../../../' + obj.data.file2 + '" class="layui-btn layui-btn-primary">附件2</a></td>';
                }
                if (obj.data.file2 != "" && obj.data.file2 != null) {
                    body += '<td  align="left" class="body"><a href="../../../' + obj.data.file3 + '" class="layui-btn layui-btn-primary">附件3</a></td>';
                }
                body += '</tr><tr style="height: 10px" class="fujian"><td colspan="4"></td>';
                $.each(obj.list, function (index, item) {
                    body += '</tr><tr><td class="itemhead head">指标名称</td><td  class="itembody body">' + item.itemName + '</td><td class="itemhead head">指标值</td><td  class="itembody body">' + item.itemValue + '</td></tr>';
                });


                $("#tab").append(body);
            }
            ,
            "json"
        )
    });
</script>

</body>


</html>